inspector: Show object title in actions tab
authorMatthias Clasen <mclasen@redhat.com>
Sat, 22 Nov 2014 20:40:24 +0000 (15:40 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 23 Nov 2014 02:38:47 +0000 (21:38 -0500)
gtk/inspector/actions.c
gtk/inspector/actions.ui

index dc7a6870a625f21ae596a3b2e527cbb5db4efd7a..aafbaec3b57fbda6a8a361e82cba83cb4551bab5 100644 (file)
@@ -27,6 +27,7 @@
 #include "gtkliststore.h"
 #include "gtkwidgetprivate.h"
 #include "gtkpopover.h"
+#include "gtklabel.h"
 
 enum
 {
@@ -43,6 +44,7 @@ struct _GtkInspectorActionsPrivate
   GtkListStore *model;
   GHashTable *groups;
   GHashTable *iters;
+  GtkWidget *object_title;
 };
 
 G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorActions, gtk_inspector_actions, GTK_TYPE_BOX)
@@ -229,6 +231,13 @@ gtk_inspector_actions_set_object (GtkInspectorActions *sl,
           g_free (prefixes);
         }
     }
+
+  if (G_IS_OBJECT (object))
+    {
+      const gchar *title;
+      title = (const gchar *)g_object_get_data (object, "gtk-inspector-object-title");
+      gtk_label_set_label (GTK_LABEL (sl->priv->object_title), title);
+    }
 }
 
 static void
@@ -277,6 +286,7 @@ gtk_inspector_actions_class_init (GtkInspectorActionsClass *klass)
 
   gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/actions.ui");
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorActions, model);
+  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorActions, object_title);
   gtk_widget_class_bind_template_callback (widget_class, row_activated);
 }
 
index c87a06bac607103e97e07a6de0a3abef929ac799..471a436f55d97de7056e8e4d8036e703f75585a9 100644 (file)
   </object>
   <template class="GtkInspectorActions" parent="GtkBox">
     <property name="orientation">vertical</property>
+    <child>
+      <object class="GtkLabel" id="object_title">
+        <property name="visible">True</property>
+        <property name="halign">fill</property>
+        <property name="valign">center</property>
+        <property name="margin-top">12</property>
+        <property name="margin-bottom">12</property>
+      </object>
+    </child>
     <child>
       <object class="GtkScrolledWindow">
         <property name="visible">True</property>